#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>

int main()
{
    printf("I am running...\n");
    pid_t id = fork();
    if (id == 0) { // child process
        while (1) {
            printf("I am child process......PID:%d, PPID:%d\n", getpid(), getppid());
            sleep(1);
        }
    }
    else if (id > 0) { // father process
        int count = 5;
        while (count) {
            printf("I am father process.....PID:%d, PPID:%d, count:%d\n", getpid(), getppid(), count);
            sleep(1);
            count--;
        }
        printf("father process quit\n");
        exit(0);
    }
    else { // fork error

    }
    return 0;
} 